package com.chijun.mform.create.dialog;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.chijun.mform.R;
import com.chijun.mform.create.activity.CreateFormActivity;
import com.chijun.mform.create.adapter.SelectOptionReFieldAdapter;
import com.chijun.mform.create.mode.FormField;
import com.chijun.mform.create.mode.FormFieldOption;
import com.example.ccj.b.c.dialog.DialogBase;
import com.example.ccj.b.c.recycler.BaseRecycler;

import java.util.List;

/**
 * 选择表单保存模式dialog
 * 点击后返回
 */
public class SelectSaveModeDialog extends DialogBase {

    ISelectSaveModeListener iSelectSaveModeListener;
    /**
     *
     * @param context 上下文
     */
    public SelectSaveModeDialog(@NonNull Context context,ISelectSaveModeListener iSelectSaveModeListener) {
        super(context);
        this.iSelectSaveModeListener = iSelectSaveModeListener;
    }

    @Override
    public void onInit() {
        isCanClose(true);
        setLayout(R.layout.dialog_select_form_save_mode);
        setAlpha(1f);//透明度
        isCanClose(true);//点击允许关闭
        isShowBackground(false);//不显示背景
        setShowHeightRatio(false);//按比例显示
        showInCenter();//底部弹出
        goneTitleLeftImage();

        TextView saveLocation = findViewById(R.id.dialog_select_form_save_mode_location);
        saveLocation.setOnClickListener(v->{
            iSelectSaveModeListener.result(CreateFormActivity.FORM_SAVE_LOCATION);
            dismiss();
        });

        TextView saveServer = findViewById(R.id.dialog_select_form_save_mode_server);
        saveServer.setOnClickListener(v->{
            iSelectSaveModeListener.result(CreateFormActivity.FORM_SAVE_SERVER);
            dismiss();
        });
    }


    public interface ISelectSaveModeListener{
        void result(int mode);
    }

}
